package com.wjl.springcloudalibaba.sentinel.gatewaysentinel.client.resttemplate;

import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
import com.wjl.springcloudalibaba.sentinel.gatewaysentinel.fallback.HelloFallback;
import com.wjl.springcloudalibaba.sentinel.gatewaysentinel.handler.HelloBlockHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author wjl
 */
@Configuration
public class EchoRestTemplate {

    @Bean
    @SentinelRestTemplate(blockHandler = "blockEchoHandler",
            blockHandlerClass = HelloBlockHandler.class,
            fallback = "echoFallback",
            fallbackClass = HelloFallback.class)
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

}
